// import { getAllRoleList } from '/@/api/demo/system';
import { getListFeedTypeTree } from '/@/api/cuisine/feed';
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';

const myMap = new Map<number, any>([
  [1, '启用'],
  [0, '禁用'],
]);
export const columns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'name',
    width: 120,
  },
  {
    title: '选择方式',
    dataIndex: 'feedMode',
    width: 120,
  },
  {
    title: '价格',
    dataIndex: 'money',
    width: 120,
  },
  {
    title: '状态',
    dataIndex: 'state',
    width: 200,
    format: myMap,
  },
  {
    title: '备注',
    dataIndex: 'remark',
    width: 200,
  },
];

export const searchFormSchema: FormSchema[] = [
 /* {
    field: 'number',
    label: '单位编码',
    component: 'Input',
    colProps: { span: 8 },
  },*/
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    colProps: { span: 8 },
  },
];
export const practiceFormSchema: FormSchema[] = [
  {
    label: '分类',
    field: 'pid',
    component: 'ApiSelect',
    componentProps: {
      immediate: false,
      api: getListFeedTypeTree,
      params: { type: 1 },
      labelField: 'name',
      valueField: 'id',
    },
    required: true,
  },
  {
    label: '名称',
    field: 'name',
    component: 'Input',
    required: true,
  },
  {
    label: '价格',
    field: 'money',
    component: 'InputNumber',
    required: true,
  },
  {
    label: '状态',
    field: 'state',
    defaultValue: 1,
    component: 'RadioGroup',
    componentProps: {
      defaultValue: 1,
      options: [
        {
          label: '启用',
          value: 1,
        },
        {
          label: '禁用',
          value: 2,
        },
      ],
    },
    required: true,
  },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
  },
  {
    label: '类型(1:分类,2:材料)',
    field: 'type',
    defaultValue: 2,
    component: 'InputNumber',
    componentProps: {
      defaultValue: 2,
    },
    show: false,
  },
];

export const FeedTypeFormSchema: FormSchema[] = [
  {
    label: '名称',
    field: 'name',
    component: 'Input',
    componentProps: {},
    required: true,
  },
  {
    label: '选择方式',
    field: 'feedMode',
    defaultValue: 1,
    component: 'RadioButtonGroup',
    componentProps: {
      defaultValue: 1,
      options: [
        {
          label: '单选',
          value: 1,
        },
        {
          label: '多选',
          value: 2,
        },
      ],
    },
    required: true,
  },
  {
    label: '状态',
    field: 'state',
    defaultValue: 1,
    component: 'RadioGroup',
    componentProps: {
      defaultValue: 1,
      options: [
        {
          label: '启用',
          value: 1,
        },
        {
          label: '禁用',
          value: 2,
        },
      ],
    },
    required: true,
  },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
  },
  {
    label: '类型(1:分类,2:材料)',
    field: 'type',
    defaultValue: 1,
    component: 'InputNumber',
    componentProps: {
      defaultValue: 1,
    },
    show: false,
  },
];
